<template>
  <ul class="newProduct" data-v-1712b3c9>
    <li data-v-1712b3c9 v-for="(item,index) in list" :key="index">
      <a href="javascript:;" class="newItem" data-v-1712b3c9 @click="detailsdata(index)">
        <img
          :src="item.picUrl"
          :alt="item.title"
          class="newPic"
          data-v-1712b3c9
        />
        <p class="title" data-v-1712b3c9>{{item.title}}</p>
        <div class="numBox" data-v-1712b3c9>
          <strong data-v-1712b3c9>￥{{item.price}}</strong>
          <span data-v-1712b3c9>{{item.weight}}kg/件</span>
        </div>
      </a>
    </li>
  </ul>
</template>

<script>
export default {
  data() {
    return {
      list: []
    };
  },
  created() {
    let url = "/api/productSet/getHotAndNewProduct";

    //根据父级传参获取相应数据
    this.$axios.post(url, { type: "1" }).then(res => {
      console.log(res.data.data);
      this.list = res.data.data;
    });
  },
  methods: {
    detailsdata(id) {
      var arr = [1, id,0];
      this.$router.push({
        path: "/details/" + arr
      });
    }
  }
};
</script>

<style>
</style>